//
//  ZHCache.m
//  ToolsEnginer
//
//  Created by 正合适 on 2017/6/1.
//  Copyright © 2017年 正合适. All rights reserved.
//

#import "ZHCache.h"
#import "ZHCacheFoundation.h"

@implementation ZHCache

#pragma mark - 缓存
+ (void)cacheWithKey:(NSString *)key value:(NSString *)value table:(NSString *)table {
    if ([[ZHCacheFoundation instance] isKey:key table:table]) {
        // key已经存在,直接更新key
        [[ZHCacheFoundation instance] updateWithVal:value key:key table:table];
    } else {
        // key不存在，插入数据
        [[ZHCacheFoundation instance] insertWithVal:value key:key table:table];
    }
}

#pragma mark - 取缓存
+ (NSString *)fromCacheWithKey:(NSString *)key table:(NSString *)table {
    return [[ZHCacheFoundation instance] selectWithKey:key table:table];
}

#pragma mark - 删除数据
+ (void)deleteCacheWithKey:(NSString *)key table:(NSString *)table {
    [[ZHCacheFoundation instance] deleteWithKey:key table:table];
}

#pragma mark - 清空表
+ (void)clearCacheWithTable:(NSString *)table {
    [[ZHCacheFoundation instance] clearTable:table];
}

@end
